package com.pzh.guli.service.statics.task;

import com.pzh.guli.service.statics.service.IDailyService;
import lombok.extern.slf4j.Slf4j;
import org.joda.time.DateTime;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class ScTask {
    @Autowired
    private IDailyService service;
    @Scheduled(cron = "0 0 12 * * ? ") //每天中午12点执行
    public void createStaticsTask(){
        log.info("Task日常统计数据");
        String day = new DateTime().minusDays(1).toString("yyyy-MM-dd");//前一天
        //生成数据
      service.createStaticsByDay(day);
    }
}
